<template>
  <div class="front shopContact">
    <div class="banner"
      :style="{backgroundImage:`url(${shopInfo.shopBackendImage?shopInfo.shopBackendImage:require('@/assets/front-img/shop/banner.png')})`}">
    </div>
    <div class="docWidth warpper">
      <div class="shopInfo">
        <div class="textBox">
          <div class="name">{{shopInfo.shopName}}</div>
          <el-row style="margin-top:17px;">
            <el-col :span="9">卖家：</el-col>
            <el-col :span="15">{{shopInfo.companyName}}</el-col>
          </el-row>
          <el-row style="margin-top:17px;font-size:15px">
            <el-col :span="9">所在地：</el-col>
            <el-col :span="15">
              {{shopInfo.companyProvinceName}}{{shopInfo.companyCityName}}{{shopInfo.companyDistrictName}}</el-col>
          </el-row>
          <!-- <el-row style="margin-top:17px;">
            <el-col :span="9">联系电话：</el-col>
            <el-col :span="15">{{shopInfo.mobile}}</el-col>
          </el-row> -->
          <el-row style="margin-top:17px;">
            <el-col :span="9">入驻时间：</el-col>
            <el-col :span="15">{{shopInfo.createTime | formatDate}}</el-col>
          </el-row>
        </div>
        <div class="countbox">
          <el-row style="margin-top:27px;">
            <el-col :span="14">成交数</el-col>
            <el-col :span="10">买家数</el-col>
          </el-row>
          <el-row style="margin-top:5px;">
            <el-col :span="14" style="color:#965f29">{{shopInfo.shopDealNum}}</el-col>
            <el-col :span="10" style="color:#965f29">{{shopInfo.shopBuyerNum}}</el-col>
          </el-row>
          <el-row style="margin-top:27px;">
            <el-col :span="14">交货周期</el-col>
            <el-col :span="10">退货率</el-col>
          </el-row>
          <el-row style="margin-top:5px;">
            <el-col :span="14" style="color:#965f29">{{shopInfo.shopDealDay}}</el-col>
            <el-col :span="10" style="color:#965f29">{{shopInfo.shopRefundRate}}</el-col>
          </el-row>
        </div>
      </div>
      <div class="contact">
        <div class="bigTitle">联系方式</div>
        <div class="textBox">
          <p>联系人：{{shopInfo.shopContactName}}</p>
          <p>QQ：{{shopInfo.shopContactQq}}</p>
          <p>微信：{{shopInfo.shopContactWexin}}</p>
          <p>电话：{{shopInfo.shopContactMobile}}</p>
          <p>地址：{{shopInfo.shopAddress}}</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapGetters, mapState } from 'vuex'
export default {
  name: 'FrontShopContact',
  filters: {
    formatDate(value) {
      if (!value) return ''
      return value.toString().split(' ')[0]
    }
  },
  data() {
    return {
      imgs: [],
      newsList: [],
      hotProduct: [],
      newProduct: []
    };
  },
  computed: {
    ...mapGetters(["userInfo"]),
    ...mapState({
      shopId: state => state.front.shopId,
      shopInfo: state => state.front.shopInfo,
    })
  },
  created() {
    const shopId = this.$route.query && this.$route.query.id && Number(this.$route.query.id)
    if (this.$store.state.front.shopId !== shopId) {
      this.$store.commit("front/SET_SHOPID", shopId)
      this.$store.dispatch('front/getShopInfo', shopId)
    }
  },
  methods: {
  },
};
</script>
<style lang="scss" scoped>
.shopContact {
  .banner {
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    height: 328px;
  }
  .bigTitle {
    font-size: 18px;
    font-weight: 400;
    color: #fff;
    line-height: 38px;
    padding: 0 25px;
    background: #965f29;
  }
  .warpper {
    margin: 25px auto;
    display: flex;
    .shopInfo {
      border: 1px solid #e5e5e5;
      padding: 30px 28px;
      box-sizing: border-box;
      width: 280px;
      margin-right: 30px;
      .textBox {
        padding-bottom: 25px;
        position: relative;
        &::after {
          content: "";
          position: absolute;
          left: -18px;
          right: -18px;
          bottom: 0;
          height: 1px;
          background: #e6e6e6;
        }
        .name {
          font-size: 18px;
          color: #000;
        }
      }
    }
    .contact {
      flex: 1;
      border: 1px solid #e5e5e5;
      .textBox {
        padding: 44px 60px;
        p {
          font-size: 18px;
          font-weight: 400;
          color: #000;
          line-height: 30px;
          padding: 7px 0;
        }
      }
    }
  }
}
</style>